package com.zhiyou.crud.service.impl;

import com.zhiyou.crud.bean.Department;
import com.zhiyou.crud.dao.DepartmentMapper;
import com.zhiyou.crud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author leibusi
 * @desc
 * @create 2021-10-19 11:09
 */
@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    DepartmentMapper departmentMapper;

    public int insert(Department dept){
        //想要实现数据的插入,要借助dao
        //调用接口的insert方法
        departmentMapper.insert(dept); //逆向工程自动生成的方法 不需要实现类
        System.out.println("=====service=======");
        return 1;
    }
    public List<Department> getDepts(){
        List<Department> list = departmentMapper.selectByExample(null);
        return list;
    }
}
